import datetime
import requests


class Messager(object):
    
    def __init__(self):
        pass
    
    def send(self):
        pass


class XiaoLB(Messager):
    def __init__(self, server, auth):
        super(XiaoLB, self).__init__()
        if server is None or auth is None:
            raise Exception('XiaoLB init failed, some parameters are missing.')
            
        self.server = server
        self.auth = auth
        
    def send(self, msg, receiver, sender=None):
        data = {
            'content': msg,
            'receiver': receiver,
            'auth': self.auth
        }
        if sender is not None:
            data['sender'] = sender
        return requests.post(url=self.server, json=data)


class Mailman(Messager):
    def __init__(self):
        super(Mailman, self).__init__()

